<template>
  <div>
    <h1>修改密码</h1>
    <span>新密码:</span>
    <input type="password" v-model="userInfo.userPwd">
    <br>
    <span>确认密码:</span>
    <input type="password" v-model="userInfo.surePwd">
    <br>
    <button type="button" @click="updatePwd">修改</button>
  </div>
</template>

<script>
  export default {
    name: "updatePwd",
    data() {
      return {
        userInfo: {
          email: "",
          userPwd: "",
          surePwd: ""
        }
      }
    },
    methods: {
      updatePwd() {
        var self = this;
        if (this.userInfo.userPwd != this.userInfo.surePwd) {
          alert("新密码和确认密码不一致");
          return;
        }
        this.$http.post("/userInfo/updatePwd",
          this.$qs.stringify(this.userInfo)
        ).then(function(rs) {
          alert(rs.data.info);

        }).catch(function(rs) {
          console.log("服务器连接错误");
        })
      }
    },
    mounted() {
      //接收邮箱验证页面传来的参数
      this.userInfo.email = this.$route.query.email;
    },
  }
</script>

<style>
</style>
